<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <link rel="stylesheet" href="css/animate.css">
    <style>
        .fade-enter,
        .fade-leave-to {
            opacity: 0;
        }
        .fade-enter-active,
        .fade-leave-active {
            -webkit-transition: opacity 3s;
            -moz-transition: opacity 3s;
            -ms-transition: opacity 3s;
            -o-transition: opacity 3s;
            transition: opacity 3s;
        }
    </style>
</head>
<body>
<div id="root">
    <!--enter-active-class、leave-active-class声明自定义class名，可使用三方库的动画效果-->
    <!--appear声明入场动画，appear-active-class声明动画方式-->
    <!--type="tansition"设置动画总时长以transition或者animate为准-->
    <!--:duration设置出场与入场动画时间-->
    <!--:duration="{enter: 3000, leave: 5000}"设置出场与入场不同的时间-->
    <transition
        :duration="5000"
        type="transition"
        name="fade"
        enter-active-class="animated swing fade-enter-active"
        leave-active-class="animated shake fade-leave-active"
        appear
        appear-active-class="animated swing"
    >
        <div v-if="show">hello</div>
    </transition>
    <button @click="handleClick">切换</button>
</div>
<script>
    let vm = new Vue({
        el:"#root",
        data: {
            show: true
        },
        methods: {
            handleClick: function () {
                this.show = !this.show
            }
        }
    })
</script>
</body>
</html>